package com.cgc.venus.server.ci.service;

import com.cgc.venus.server.ci.inter.DemoService;
import com.cgc.venus.server.ci.model.dao.DemoDao;
import com.cgc.venus.server.ci.model.entity.Demo;
import com.cgc.venus.server.core.base.AbstractBaseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 业哥 on 2018/5/22.
 */
@Service
public class DemoServiceImpl extends AbstractBaseService implements DemoService {
    @Autowired
    private DemoDao demoDao;
    @Override
    public PageInfo<Demo> findByKey(String key,int pageNum,int rowNum) {
        PageHelper.startPage(pageNum,rowNum,true,true);
        List<Demo> demos=demoDao.findByKey(key);
        PageInfo<Demo> pageInfo = new PageInfo(demos);
        return pageInfo;
    }

    @Override
    public int insertDemo(Demo demo){
        return demoDao.insertDemo(demo);
    }

    @Override
    public int updateDemo(Demo demo){
        return demoDao.updateDemo(demo);
    }

    @Override
    public int deleteDemoById(String id){
        return demoDao.deleteDemoById(id);
    }

}
